package com.ljf.authority.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.authority.domain.repository.AuthorityBaseMenuPageDetailRepository;
import com.ljf.authority.dto.query.AuthorityBaseMenuPageDetailQuery;
import com.ljf.authority.infra.mapper.AuthorityBaseMenuPageDetailMapper;
import com.ljf.authority.model.AuthorityBaseMenuPageDetail;
import com.ljf.authority.vo.AuthorityBaseMenuPageDetailVO;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import com.ljf.common.utils.StringUtil;
import org.springframework.stereotype.Component;

/**
 * 页面明细  数据访问接口实现
 *
 * @author LJF
 * @since 2024-10-18
 */
@Component
public class AuthorityBaseMenuPageDetailRepositoryImpl extends BasisRepositoryImpl<AuthorityBaseMenuPageDetailMapper, AuthorityBaseMenuPageDetail, AuthorityBaseMenuPageDetailQuery, AuthorityBaseMenuPageDetailVO> implements AuthorityBaseMenuPageDetailRepository {

    @Override
    protected QueryWrapper<AuthorityBaseMenuPageDetail> fillWrapper(AuthorityBaseMenuPageDetailQuery query, boolean sort) throws ServiceException {
        QueryWrapper<AuthorityBaseMenuPageDetail> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getCodeList())) {
            wrapper.in(AuthorityBaseMenuPageDetail.COL_CODE, query.getCodeList());
        }
        if (StringUtil.isNotEmpty(query.getCodeRightLike())) {
            wrapper.likeRight(AuthorityBaseMenuPageDetail.COL_CODE, query.getCodeRightLike());
        }
        return wrapper;
    }

}
